package com.example.springinitialization.interception;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;

@Configuration
public class LWebMvcConfigurer implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 白名单
        ArrayList<String> whiteList = new ArrayList<>();
        whiteList.add("/login");
        // 注册拦截器
        registry.addInterceptor(new LoginInterceptor())
                .excludePathPatterns(whiteList)
                .addPathPatterns("/**");
    }
}
